// TaskDashboardController.java
package com.example.demo.controller;

import com.example.demo.service.TaskDashboardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/task-dashboard")
public class TaskDashboardController {

    @Autowired
    private TaskDashboardService taskDashboardService;

    /**
     * 获取课程任务数据看板
     */
    @GetMapping("/course/{courseId}")
    public ResponseEntity<TaskDashboardVO> getTaskDashboard(@PathVariable String courseId) {
        TaskDashboardVO dashboard = taskDashboardService.getTaskDashboard(courseId);
        return ResponseEntity.ok(dashboard);
    }

    /**
     * 获取任务热度看板
     */
    @GetMapping("/heat/{courseId}")
    public ResponseEntity<TaskHeatVO> getTaskHeatDashboard(@PathVariable String courseId) {
        TaskHeatVO heatVO = taskDashboardService.getTaskHeatDashboard(courseId);
        return ResponseEntity.ok(heatVO);
    }
}